import {Increment, Decrement, LoadModuleMenu} from '../Action'

export default (state, action) => {
    const {counterCaption, value} = action;
    switch (action.type) {
        case Increment:
            return {...state, [counterCaption]: state[counterCaption] + 1};
        case Decrement:
            return {...state, [counterCaption]: state[counterCaption] - 1};
        case LoadModuleMenu:
            return {...state, [counterCaption]: value};
        default:
            return state
    }
}
